package test2

import (
	"lifi"
	"lifi/plugins/transfers"
	"log"
)

type Test2 struct {
	Name string
}

func (t Test2) Init() error {
	return nil
}

func (t Test2) Start(collector lifi.Collector) error {
	log.Printf("start test2 transfer\n")
	return nil
}

func (t Test2) Stop() {
	log.Printf("stop test2 transfer\n")
}

func (t Test2) Process(d lifi.Data, acc lifi.Collector) error {
	log.Printf("add test2 transfer\n")
	log.Printf("process test2 transfer\n")
	data := d.(lifi.ByteData)
	nweData := lifi.NewByteData([]byte(string(data.Data)+" test2 processd"), "test1")
	acc.Collect(nweData)
	return nil
}

var _ lifi.Transfer = &Test2{}

func init() {
	transfers.Add("test2", func() lifi.Transfer {
		return &Test2{}
	})
}
